<template>
    <div class="app-container">
        <el-form class="lookForm" :model="queryParams" ref="queryForm" size="mini" :inline="true" label-width="140px">
            <el-form-item label="学号" prop="stuNo">
                <el-input v-model="queryParams.stuNo" placeholder="请输入学号" clearable @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="学生姓名" prop="stuName">
                <el-input v-model="queryParams.stuName" placeholder="请输入学生姓名" clearable
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="学生学院" prop="stuDept">
                <el-input v-model="queryParams.stuDept" placeholder="请输入学生学院" clearable
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="岗位名称" prop="postName">
                <el-input v-model="queryParams.postName" placeholder="请输入岗位名称" clearable
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="设岗部门" prop="deptName">
                <el-input v-model="queryParams.deptName" placeholder="请输入设岗部门" clearable
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="工作月份" prop="workMonth">
                <el-date-picker clearable v-model="queryParams.workMonth" type="month" value-format="yyyy-MM"
                    placeholder="请选择工作月份">
                </el-date-picker>
            </el-form-item>

            <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            </el-form-item>
        </el-form>

        <el-table v-loading="loading" :data="tableData">
            <el-table-column label="学号" align="center" prop="stu_no" />

            <el-table-column label="姓名" align="center" prop="stu_name" />
            <el-table-column label="学生学院" align="center" prop="stu_dept" />

            <el-table-column label="岗位名称" align="center" prop="post_name" />
            <el-table-column label="岗位类型" align="center" prop="post_type" />
            <el-table-column label="设岗部门" align="center" prop="dept_name" />
            <el-table-column label="工作月份" align="center" prop="work_month" />

            <el-table-column label="工作时长" align="center">
                <template v-slot="{ row }">
                    {{ row.post_type == "固定岗位A" ? row.total_time + "天" : row.total_time + "小时" }}
                </template>
            </el-table-column>
        </el-table>

        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize" @pagination="getList" />


    </div>
</template>
<script>

import { listWorkLogMonthTotal as getList } from "@/api/workstudy/worklog";

import { fullLoading, isEmpty } from "@/api/helpFunc";
import { getToken } from "@/utils/auth";

export default {
    name: "workstudy-StuPost-zdls",
    dicts: ['qgzx_stu_post_status'],
    data() {
        return {
            isEmpty,
            loading: false,

            tableData: [],
            total: 0,
            queryParams: {
                pageNum: 1,
                pageSize: 10,
                postName: null
            },



        }
    },
    created() {
        this.getList();
    },
    methods: {

        async getList() {
            this.loading = true;
            let res = await getList(this.queryParams);
            this.loading = false;
            if (res.code == 200) {
                this.tableData = [...res.rows];
                this.total = res.total;
            }
        },
        handleQuery() {
            this.queryParams.pageNum = 1;
            this.getList();
        },
        resetQuery() {
            this.resetForm("queryForm");
            this.handleQuery();
        },
    }
}



</script>


<style scoped lang="scss">
.lookForm {
    .el-form-item {
        margin-bottom: 5px;
    }
}
</style>